package cn.sirun.com.fca.map.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;

import com.tencent.tencentmap.mapsdk.maps.TencentMapOptions;

import static android.view.MotionEvent.ACTION_DOWN;
import static android.view.MotionEvent.ACTION_UP;

public class MapView extends com.tencent.tencentmap.mapsdk.maps.TextureMapView {

    public MapView(Context context) {
        super(context);
    }

    public MapView(Context context, TencentMapOptions tencentMapOptions) {
        super(context, tencentMapOptions);
    }

    public MapView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public MapView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
        switch (ev.getAction()){
            case ACTION_DOWN:{
                getParent().requestDisallowInterceptTouchEvent(true);
            }break;
            case ACTION_UP:{
                getParent().requestDisallowInterceptTouchEvent(false);
            }break;
        }
        return super.dispatchTouchEvent(ev);
    }
}
